<template>
  <div class="getFile-box">
    <el-button type="primary" size="mini" style="margin-left:70px;" icon="el-icon-refresh" @click="reload">重 置</el-button>
    <div class="bindFile-box">
      <el-table v-loading="loading" :data="bindItem" border>
        <el-table-column label="项目编号" align="center" prop="bindCode" />
        <el-table-column label="项目名称" align="center" prop="bindName" />
        <el-table-column label="投标截止时间" align="center" prop="ntEndTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.ntEndTime, "{y}-{m}-{d}") }}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
 
    <div class="getFile-title">招标文件下载信息</div>
    
    <div class="getFileList-box">
      <el-table :data="loadFileList" border>
        <!-- 添加序号列 -->
        <el-table-column
          label="序号"
          type="index"
          width="70"
          align="center"
          index-method="indexMethod"
        />
        <el-table-column label="项目编号" align="center" prop="bindCode" />
        <el-table-column label="投标人名称" align="center" prop="supName" />
        <el-table-column label="联系人" align="center" prop="contacts" />
        <el-table-column label="联系方式" align="center" prop="phone" />
        <el-table-column label="下载时间" align="center" prop="loadTime">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.loadTime, "{y}-{m}-{d}") }}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { listNotice } from "@/api/purs/notice";
import {
  listLoadFiles,
  getLoadFiles,
  delLoadFiles,
  addLoadFiles,
  updateLoadFiles,
} from "@/api/purs/loadFiles";
export default {
  props: {
    openMessage: {
      type: Object,
    },
  },
  created() {
    this.needObj.bindCode = this.openMessage.bindCode;
    this.needObj.bindName = this.openMessage.bindName;

    this.queryParams.bindCode = this.openMessage.bindCode;
    listNotice(this.queryParams).then((res) => {
      this.needObj.ntEndTime = res.rows[0].ntEndTime;
    });
    this.bindItem = [];
    this.bindItem.push(this.needObj);
  },
  mounted() {
    this.loadFileInit();
  },
  data() {
    return {
      loading: false,
      bindItem: [],
      needObj: {},
      loadFileList: [],

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        fileName: null,
        filePath: null,
        fileSize: null,
        uploadTime: null,
        creater: null,
        bindCode: null,
        type: 2,
      },
    };
  },
  methods: {

    reload(){  
      this.loadFileInit();
    },

    indexMethod(index) {
      // 根据需要自定义序号生成方式，这里只是简单返回索引+1
      return index + 1;
    },

    loadFileInit() {
      listLoadFiles({
        bindCode: this.needObj.bindCode,
      }).then((res) => {
        this.loadFileList = res.rows;
      });
    },
  },
};
</script>

<style scoped>
.bindFile-box {
  width: 1200px;
  height: 100px;
  margin: 20px auto;
}

.getFileList-box {
  width: 1200px;
  overflow: auto;
  margin: 10px auto;
}

.getFile-title {
  width: 200px;
  margin-top: 100px;
  margin-left: 70px;
  text-indent: 25px;
  line-height: 20px;
  font-family: "仿宋";
  color: black;
  font-weight: bold;
  font-size: 17px;
  font-style: italic;
  background-image: url("../../image/_详情\ \(1\).png");
  background-repeat: no-repeat;
  background-position: 0px center;
  background-size: 23px 23px;
}
</style>

